import ekf_testv6 as ekf
import numpy as np
import matplotlib.pyplot as plt

fig, ax= plt.subplots(2, 4, figsize=(10,8), gridspec_kw={ "hspace": 0.3, "wspace": 0.3})

typredict=["GMST","OHCA"]

allqqyker=np.array(ekf.qqykerall)

for i in [0,1]:
    ax[i,0].set_ylabel("Probability Density")
    for j in range(4):
        sd=j*50
        if j==0:
           sd=1 
        ed=(j+1)*50
        if j==3:
            ed=ed-50+23
        
        ax[i,j].plot(ekf.xnorm,np.mean(allqqyker[sd:ed,i,:],axis=0), color=ekf.colorekf)
        ax[i,j].plot(ekf.xnorm,ekf.ynorm, color=ekf.pcolor)
        ax[i,j].set_xlabel("Pred.Std Dev ($\sqrt{S_{n}}$["+str(i)+","+str(i)+"])",labelpad=-3)
        ax[i,j].set_title(typredict[i]+": "+str(sd+1850)+"-"+str(ed+1850))
fig.suptitle("EBM-KF Residuals Over Time")
plt.show()


